﻿using SqlSugar;

namespace Bigway.Common.Services.Repositories;

public interface IBaseRepository<TEntity>
{
    Task<List<TEntity>> GetAllAsync(CancellationToken token = default);

    Task<List<TEntity>> GetAllAsync(
        Func<ISugarQueryable<TEntity>, ISugarQueryable<TEntity>> filter,
        CancellationToken token = default);

    Task<TEntity> AddAsync(TEntity entity, CancellationToken token = default);

    Task AddAllAsync(List<TEntity> entities, CancellationToken token = default);

    Task UpdateAsync(TEntity entity, CancellationToken token = default);

    Task UpdateAllAsync(List<TEntity> entities, CancellationToken token = default);

    Task DeleteAsync(TEntity entity, CancellationToken token = default);

    Task DeleteAllAsync(List<TEntity> entities, CancellationToken token = default);
}